<?php

/**
 * @developer socheat 
 * @copyright 2012
 */
    $report = mysql_query("SELECT * FROM counter
            INNER JOIN tblproduct AS pro ON pro.`id`=counter.`pd_id`
            WHERE by_user='".$_SESSION['acc_id']."'  LIMIT 5");
            
            
// personal page seller
    $strin          ="";
    $st             = $_SESSION['acc_id'];    
    $company        = new company();
    $company        ->getcompany($strin,$st);    
// end personal page seller 

// last post
    $sts            = "owner='".$_SESSION['acc_id']."' ORDER BY id DESC LIMIT 0,5";    
    $product        = new prodcut_tb(); 
    $GetAll         = $product ->product_list($sts);    
// end last post

// count post
    $pro_count      = "owner='".$_SESSION['acc_id']."'";    
    $product        = new prodcut_tb(); 
    $procount       = $product ->product_list($sts);
    $num_rows = mysql_num_rows($procount);       
// end count post            
?>

	<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
	<style>
    .toggler
    {
        margin: 10px 0 0 0;
    }
	.button {		
		text-decoration: none;        
	}
    .point
    {
        cursor: pointer;
    }
	#effect {
		position: relative;
		padding: 0.4em;
	}
	h3.statistic {
		margin: 0;
		padding: 0.4em;
		text-align: left;
        font-size: 14px;
        display:block;
	}
    .t_none
    {
        border:none;
    }
	</style>
<div style="margin: 10px 15px 0 0;">
 <!--right now-->
        <h3 class="statistic ui-widget-header ui-corner-all"><!--Right Now--><?php echo $lang['RIG_NOW'];?></h3>
			<table class="t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" valign="middle"><!--Page views--><?php echo $lang['PAGE_VIEW'];?>:</td>
                <td class="right" valign="middle"><?php echo $company->views;?></td>
              </tr>
              <tr>
                <td align="center" valign="middle"><!--Content--><?php echo $lang['CONTENT'];?>:</td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT;?>/seller/product/"><strong><?php echo $num_rows;?></strong> <!--Products--><?php echo $lang['PRODUCT'];?></a></td>
              </tr>
            </table>
<!--end right now-->    

<!--last article-->  
		<h3 class="statistic point ui-widget-header ui-corner-all"><!--Last 5 Added Articles--><?php echo $lang['LAST_ADD_ARTICLE'];?></h3>    
<table class="t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="middle"><strong><!--ID--><?php echo $lang['ID'];?></strong></td>
    <td align="center" valign="middle"><strong><!--Product name--><?php echo $lang['PRODUCTNAME'];?></strong></td>
  </tr>

<?php   
    $i=1;         
        while($ros = mysql_fetch_array($GetAll)){ 
            $i++;
            ?>
          <tr>
    <td><?php echo $ros['id'];?></td>
    <td><?php echo $ros['product_name'];?></td>
  </tr>        
<?php    
    }    
?>

</table>
<!--end last article--> 

    
<!--top article--> 
		<h3 class="statistic ui-widget-header ui-corner-all"><!--Top 5 Popular Articles--><?php echo $lang['TOP5_POP'] ;?></h3>    
<table class="t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="9%" align="center" valign="middle"><strong><!--ID--><?php echo  $lang['ID'];?></strong></td>
    <td width="74%" align="center" valign="middle"><strong><!--Product name--><?php echo $lang['PRODUCTNAME'];?></strong></td>
    <td width="17%" align="center" valign="middle"><strong><!--Hits--><?php echo $lang['HITS'];?></strong></td>
  </tr>

<?php   
    $i=1;         
        while($report_get = mysql_fetch_assoc($report))
        {
            $i++;
            ?>
          <tr>
    <td><?php echo $report_get['id'];?></td>
    <td><?php echo $report_get['product_name'];?></td>
    <td><?php echo $report_get['top_view'];?></td>
  </tr>        
<?php    
    }    
?>

</table>
<!--end top article--> 


<!--best sell-->
<h3 class="statistic ui-widget-header ui-corner-all"><!--Top 5 Seller Articles--><?php echo $lang['TOPFIVESELLER'];?></h3>
<?php
				$sql = "SELECT t1.*, t1.top_sale, t3.price, t3.pid, t2.images, t2.thumbnail, t1.owner FROM tblproduct AS t1
                        INNER JOIN tblimage AS t2 ON t1.id=t2.product_id
                        INNER JOIN tblproduct_in_pharmacy AS t3 ON t1.id=t3.product_id
                        WHERE t1.status = 1 AND t1.owner='".$_SESSION['acc_id']."' ORDER BY t1.top_sale DESC LIMIT 0,5";
				$result = mysql_query($sql);
				$i=0;
				$border = "";
				?>
<table class="t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="6%" align="center" valign="middle"><strong>No</strong></td>
    <td width="10%" align="center" valign="middle"><strong><!--ID--><?php echo  $lang['ID'];?></strong></td>
    <td align="center" valign="middle"><strong><!--Product name--><?php echo $lang['PRODUCTNAME'];?></strong></td>
  </tr>                
<?php
while($row = mysql_fetch_assoc($result)){
					if($i % 4 == 0 && $i>0){
						echo '';
					}else if ($i % 4 > 0){
						$border = '';
					}
				?>               

  <tr>
    <td><span class="count"><?php echo $i+1; ?>.</span></td>
    <td><?php echo $row['id']?></td>
    <td> <a class="pro-name" href="<?php echo W_ROOT;?>/product/product_detail.php?product_id=<?php echo $row['id']?>" title="<?php echo $row['product_name']?>" target="_blank"><?php echo $row['product_name']?></a></td>
  </tr>                           
       <?php $i++; } ?>
</table>
<!--end best sell-->
</div>    